
<template>
    <div>
        <div ref="chart" style="width:50%;height:376px"></div>
    </div>
</template>
  
<script>

export default {
    data() {
        return {
            info: ""
        }
    },
    mounted() {
        console.log(this.$route);

        this.getEchartData()
    },
    methods: {
        getEchartData() {
            const chart = this.$refs.chart
            if (chart) {
                const myChart = this.$echarts.init(chart)
                const option = {
                    legend: {},
                    tooltip: {},
                    xAxis: {
                        data: ['订单1', '订单2', '订单3', '订单4', '订单5', '订单6', '订单7']
                    },
                    yAxis: {},
                    series: [
                        {
                            type: 'line',
                            data: [83.1, 86.4, 72.4, 82.4, 42.4, 72.4, 72.4]
                        }, {
                            type: 'bar',
                            data: [73.4, 65.2, 53.9, 53.9, 53.9,53.9, 53.9]
                        }
                    ]
                }
                myChart.setOption(option)
                window.addEventListener("resize", function () {
                    myChart.resize()
                })
            }
            this.$on('hook:destroyed', () => {
                window.removeEventListener("resize", function () {
                    myChart.resize();
                });
            })
        },

    },
    watch: {},
    created() {
    }
}
</script>
  
  
  
  